/**
 * 
 */
package com.ineatconseil.yougo.client.ui.common;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
import com.ineatconseil.yougo.client.ui.main.application.ApplicationActivity;
import com.ineatconseil.yougo.client.ui.main.application.ApplicationPlace;
import com.ineatconseil.yougo.client.ui.main.application.tabs.requestTypesMngt.RequestTypesActivity;
import com.ineatconseil.yougo.client.ui.main.application.tabs.requestTypesMngt.RequestTypesPlace;
import com.ineatconseil.yougo.client.ui.main.application.tabs.requestsMngt.RequestsActivity;
import com.ineatconseil.yougo.client.ui.main.application.tabs.requestsMngt.RequestsPlace;
import com.ineatconseil.yougo.client.ui.main.application.tabs.requestsValidationMngt.RequestsValidationActivity;
import com.ineatconseil.yougo.client.ui.main.application.tabs.requestsValidationMngt.RequestsValidationPlace;
import com.ineatconseil.yougo.client.ui.main.application.tabs.userTypesMngt.UserTypesActivity;
import com.ineatconseil.yougo.client.ui.main.application.tabs.userTypesMngt.UserTypesPlace;
import com.ineatconseil.yougo.client.ui.main.application.tabs.usersMngt.UsersActivity;
import com.ineatconseil.yougo.client.ui.main.application.tabs.usersMngt.UsersPlace;
import com.ineatconseil.yougo.client.ui.main.login.LoginActivity;
import com.ineatconseil.yougo.client.ui.main.login.LoginPlace;

/**
 * @author aelamrani
 */
public class YougoActivityMapper implements ActivityMapper {
	
	private final ClientFactory clientFactory;

	public YougoActivityMapper(ClientFactory clientFactory) {
		super();
		this.clientFactory = clientFactory;
	}

	public Activity getActivity(Place place) {
		
		// Login
		if (place instanceof LoginPlace) {
			return new LoginActivity((LoginPlace) place, clientFactory);
		
		// Application
		} else if (place instanceof ApplicationPlace) {
			return new ApplicationActivity((ApplicationPlace) place, clientFactory);
		
		// All Tabs Places
		} else if (place instanceof RequestsPlace) {
			return new RequestsActivity((RequestsPlace) place, clientFactory);
		} else if (place instanceof RequestsValidationPlace) {
			return new RequestsValidationActivity((RequestsValidationPlace) place, clientFactory);
		} else if (place instanceof UsersPlace) {
			return new UsersActivity((UsersPlace) place, clientFactory);
		} else if (place instanceof UserTypesPlace) {
			return new UserTypesActivity((UserTypesPlace) place, clientFactory);
		} else if (place instanceof RequestTypesPlace) {
			return new RequestTypesActivity((RequestTypesPlace) place, clientFactory);
		}
		
		return null;
		
	}
	
}
